package com.example.demo.entity;

import com.fasterxml.jackson.annotation.JsonProperty;

public class WebOfficeResponse<T> {
    @JsonProperty("code")
    private int code;

    @JsonProperty("message")
    private String message;

    @JsonProperty("data")
    private T data;

    public WebOfficeResponse(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
   
    public static <T> WebOfficeResponse<T> ok(T data) {
        return new WebOfficeResponse<>(0, "ok", data);
    }

    public static <T> WebOfficeResponse<T> error(int code, String message) {
        return new WebOfficeResponse<>(code, message, null);
    }

}